﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="InnerIndex.aspx.cs" Inherits="Cms.Web.CmsSystem.InnerIndex" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>首页</title>

    <script src="/Scripts/jquery-1.3.2.min.js" type="text/javascript"></script>

    <script src="/Scripts/core.js" type="text/javascript"></script>

    <script src="/Scripts/zTree/jquery.ztree.core-3.1.min.js" type="text/javascript"></script>

    <link href="/App_Themes/Default/zTreeStyle/zTreeStyle.css" rel="stylesheet" type="text/css" />
    <link href="../App_Themes/Default/jerichotab/jquery.jerichotab.css" rel="stylesheet"
        type="text/css" />

    <script src="../Scripts/jerichotab/jquery.jerichotab.js" type="text/javascript"></script>

    <script type="text/javascript">
        var TreeJson = [<%=TreeJson%>];
        var curMenu = null, zTree_Menu = null;
        var setting = {
            view: {
                showLine: true,
                selectedMulti: false,
                dblClickExpand: false
            },
            data: {
                simpleData: {
                    enable: true
                }
            },
            callback: {
                onNodeCreated: this.onNodeCreated,
                beforeClick: this.beforeClick,
                onClick: this.onClick
            }
        };
        function beforeClick(treeId, node) {
            if (node.isParent) {
               if (node.level === 0) {
                    var pNode = curMenu;
                    while (pNode && pNode.level !== 0) {
                        pNode = pNode.getParentNode();
                    }
                    if (pNode !== node) {
                        var a = $("#" + pNode.tId + "_a");
                        a.removeClass("cur");
                        zTree_Menu.expandNode(pNode, false);
                    }
                    a = $("#" + node.tId + "_a");
                    a.addClass("cur");

                    var isOpen = false;
                    for (var i = 0, l = node.children.length; i < l; i++) {
                        if (node.children[i].open) {
                            isOpen = true;
                            break;
                        }
                    }
                    if (isOpen) {
                        zTree_Menu.expandNode(node, true);
                        curMenu = node;
                    } else {
                        zTree_Menu.expandNode(node.children[0].isParent ? node.children[0] : node, true);
                        curMenu = node.children[0];
                    }
                   // zTree_Menu.expandNode(node);
                } else {
                    zTree_Menu.expandNode(node);
                }
            }
            return true//;!node.isParent;
        }
        function onClick(e, treeId, node) {
            if(node && node.tabtype!="-1"){
                var url="InnerPage.aspx?id="+node.id;
                AddTab($("#"+node.tId),node.name,url,null);
            }
            return false ;
        }
        function AddTab(tabFirer,title,url,closeable,icon){
            if(typeof(closeable)=="undefined" || closeable ==null)
                closeable =true ;
            $.fn.jerichoTab.addTab({tabFirer: tabFirer,title: title,closeable: closeable,iconImg: icon,data: {dataType: "iframe",dataLink: url}}).showLoader().loadData();
            $('#jerichotab_contentholder>.righttag').hide();//隐藏
        }
        $(function() {            
            var h = GetInnerHeight();
            var wwin=GetInnerWidth();
            $("#Left,#split,Right").css("height", h + "px");
            $("#Right").css("width",wwin -200-5);      
            $.fn.zTree.init($("#LeftTree"), setting, TreeJson);
            zTree_Menu = $.fn.zTree.getZTreeObj("LeftTree");
            
            if(zTree_Menu.getNodes().length>0){
                curMenu =zTree_Menu.getNodes()[0] ;
                zTree_Menu.selectNode(curMenu);
            }
            BuildTopTab();
        });
        function BuildTopTab() {
            var h = GetInnerHeight();
            var w = $("#Right").width();            
            $.fn.initJerichoTab({
                renderTo: '#Right',uniqueId: 'InnerTabPage',contentCss: { 'height': h,"width":w },tabWidth:120,
                tabs: [{
                        title: '欢迎光临',closeable: false,data: { dataType: 'iframe', dataLink: 'InnerPage.aspx?id='+request("tabid") }
                    }],activeTabIndex: 0,loadOnce: true
                });
            }
    </script>

    <style type="text/css">
        /*左侧菜单样式*/.ztree
        {
            padding: 0;
        }
        .ztree li a.level0
        {
            /*width: 200px;*/
            height: 22px;
            text-align: left;
            padding-left: 10px;
            margin-right: 0;
            display: block;
            background-color: #ace;
            background: url("../App_Themes/Default/Images/headerbg.gif") repeat-x;
            border: 1px #ace solid;
        }
        .ztree li a.level0.cur
        {
            /*background-color: #66A3D2;*/ /*background:url("../App_Themes/Default/Images/titlebg.gif") repeat-x;  */
            background: url("../App_Themes/Default/Images/headerbg.gif") repeat-x;
            background-position: 50% 50%;
        }
        .ztree li a.level0 span
        {
            display: block; /*color: white;*/
            padding-top: 3px;
            font-size: 12px;
            font-weight: bold;
            word-spacing: 2px;
        }
        .ztree li a.level0 button
        {
            float: right;
            margin-left: 10px;
            visibility: visible;
            display: none;
        }
        .ztree li button.switch.level0
        {
            display: none;
        }
    </style>
</head>
<body style="margin: 0; padding: 0; overflow: hidden;">
    <div id="Left" style="width: 200px; margin: 0; padding: 0; float: left;" valign="top">
        <ul id="LeftTree" class="ztree" style="width: 200px">
        </ul>
    </div>
    <div id="split" style="width: 5px; background: #ccc; margin: 0; padding: 0; float: left;"
        valign="top">
    </div>
    <div id="Right" valign="top" style="margin: 0; padding: 0; float: left;">
    </div>
</body>
</html>
